<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        h1 {
            margin-top: 0;
        }

        ul {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        form {
            margin: 0 auto;
            width: 400px;
            padding: 1em;
            border: 1px solid #CCC;
            border-radius: 1em;
        }

        div+div {
            margin-top: 1em;
        }

        label span {
            display: inline-block;
            width: 120px;
            text-align: right;
        }

        input,
        textarea {
            font: 1em sans-serif;
            width: 250px;
            box-sizing: border-box;
            border: 1px solid #999;
        }

        input[type=checkbox],
        input[type=radio] {
            width: auto;
            border: none;
        }

        input:focus,
        textarea:focus {
            border-color: #000;
        }

        textarea {
            vertical-align: top;
            height: 5em;
            resize: vertical;
        }

        fieldset {
            width: 250px;
            box-sizing: border-box;
            margin-left: 136px;
            border: 1px solid #999;
        }

        button {
            margin: 20px 0 0 124px;
        }

        label {
            position: relative;
        }
    </style>
</head>

<body>
    <form>
        <!-- 标题 -->
        <h1>Payment form</h1>
        <p>Required fields are followed by <strong><abbr title="required">*</abbr></strong>.</p>

        <!-- 利用section将联系人信息单独包含起来 -->
        <section>
            <h2>Contact information</h2>
            <fieldset>
                <legend>Title</legend>
                <ul>
                    <li>
                        <!-- 将input嵌套在label中 使得点击有效的范围变大 -->
                        <label for="title_1">
                            <input type="radio" name="title" id="title_1" value="K">King
                        </label>
                    </li>
                    <li>
                        <label for="title_2">
                            <input type="radio" id="title_2" name="title" value="Q">
                            Queen
                        </label>
                    </li>
                    <li>
                        <label for="title_3">
                            <input type="radio" id="title_3" name="title" value="J">
                            Joker
                        </label>
                    </li>
                </ul>
            </fieldset>
            <p><label for="name">
                    <span> Name:</span><b><Abbr title="required">*</Abbr></b>
                </label>
                <input type="text" name="username" id="name">
            </p>
            <p>
                <label for="mail">
                    <span>E-mail: </span>
                    <strong><abbr title="required">*</abbr></strong>
                </label>
                <input type="email" id="mail" name="usermail">
            </p>
            <p>
                <label for="pwd">
                    <span>Password: </span>
                    <strong><abbr title="required">*</abbr></strong>
                </label>
                <input type="password" id="pwd" name="password">
            </p>
        </section>
        <section>
            <h2>Payment information</h2>
            <p><label for="card">
                    <span>Card type:</span>
                </label>
                <select name="usercard" id="card">
                    <!-- 下拉选择 option要包含在select中 -->
                    <option value="visa">Visa</option>
                    <option value="mc">Mastercard</option>
                    <option value="amex">American Express</option>
                </select>
            </p>
            <p><label for="number">
                    <span>Card number:</span>
                    <strong><abbr title="required">*</abbr></strong>
                </label>
                <input type="number" id="number" name="cardnumber">
            </p>
            <p>
                <label for="date">
                    <span>Expiration date:</span>
                    <strong><abbr title="required">*</abbr></strong>
                    <em>formatted as mm/yy</em>
                </label>
                <input type="date" id="date" name="expiration">
            </p>
        </section>
        <p><button type="submit">Validate the payment</button></p>
    </form>
</body>

</html>